//
//  BodyBase.h
//  QBIM
//
//  Created by liunian on 14-3-17.
//  Copyright (c) 2014年 liunian. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ProtocolConfig.h"
#import "MessageContent.h"
#import "QBBaseParmModel.h"
#import "PayloadBase.h"

@interface BodyBase : QBBaseParmModel
_PROPERTY_NONATOMIC_ASSIGN(int, I);//I: packet seq number int32
@end

//授权请求:(client)
@interface AuthBody : BodyBase
@property (nonatomic, retain) NSString *V;//V: version
_PROPERTY_NONATOMIC_ASSIGN(AuthType, AT);;//AT: Auth Type
@property (nonatomic, retain) NSString *AP;//AP: Auth Payload
@end

//心跳请求:(server/client)/心跳应答:(server/client)
@interface BeatBody : BodyBase
@property (nonatomic, retain) NSString *CT;//CT: Create Timestamp
@end

//消息状态报告:(server/client)
@interface StatusBody : BodyBase
@property (nonatomic, retain) NSString *U;//U: Message UUID
@property (nonatomic, retain) NSString *ST;//ST: Message Stage
@end

//应答:(server/client)
@interface RespBody : BodyBase
_PROPERTY_NONATOMIC_ASSIGN(int, EC)//EC: Error Code int
@property (nonatomic, retain) NSString *EM;//EM: Error Message
@end

//系统命令:(server)/系统报文:(client)
@interface SysCMDBody : BodyBase
@property (nonatomic, retain) SysCMDPayload *P;//P: Payload
@end

//消息列表: (server)
@interface MessageBody : BodyBase
@property (nonatomic, retain) NSArray *M;//M: Content Message List
@end

@interface HeaderBody : NSObject
@property (nonatomic, retain) NSString *bodyJSON;
@property (nonatomic, assign) PacketType packetType;
@property (nonatomic, assign) PacketFormat packetFormat;

- (id)initWithBody:(id)body;
- (NSData *)prepareSendData;
@end